#ifndef INCLUDE_MAIL_BOX_
#define INCLUDE_MAIL_BOX_

#include "type.h"
#include "sync.h"

#define MAX_MBOX_LENGTH (64)
#define MAX_NAME_LENGTH 32

typedef struct mailbox
{
    char name[MAX_NAME_LENGTH];
    int num;
    int send_ptr, recv_ptr;
    int valid_size;
    char msg[MAX_MBOX_LENGTH];
    queue_t waiting_queue;
} mailbox_t;

void do_mbox_init();
mailbox_t *do_mbox_open(char *);
void do_mbox_close(mailbox_t *);
void do_mbox_send(mailbox_t *, void *, int);
void do_mbox_recv(mailbox_t *, void *, int);

#endif